package com.onpositive.datacollection.editor;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;

import com.onpositive.semantic.model.api.factory.IFactoryProvider;
import com.onpositive.semantic.model.api.meta.BaseMeta;
import com.onpositive.semantic.model.api.meta.DefaultMetaKeys;
import com.onpositive.semantic.model.api.meta.IMeta;
import com.onpositive.semantic.model.api.property.IFunction;

public class FileFactoryProvider implements IFactoryProvider{

	@Override
	public IFunction getElementFactory(Object model) {
		return new IFunction() {
			
			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public IMeta getMeta() {
				BaseMeta m=new BaseMeta();
				m.putMeta(DefaultMetaKeys.CAPTION_KEY, "...");
				return m;
			}
			
			@Override
			public Object getValue(Object context) {
				FileDialog fdlg=new FileDialog(Display.getCurrent().getActiveShell());
				String open = fdlg.open();
				return open;
			}
		};
	}

}
